using System;
using System.Collections.Generic;
using System.Text;

using Deepcode.Flux.Core.Systems.Workflow.Enums;
using Deepcode.Flux.Core.Systems.Workflow.Info;
using Deepcode.Flux.Core.Systems.Workflow.Bases;

namespace Deepcode.Flux.Core.Systems.Workflow.Interfaces
{
	/// <summary>
	/// The base interface for all workflow handlers. Generally one should inherit from
	/// the GlobalWorkflowBaseHandler class to implement common workflow actions automatically,
	/// but one can implement this interface directly.
	/// </summary>
	public interface IWorkflowHandler
	{
		#region Edit / Delete Safety
		/// <summary>
		/// This function should return true or false depending on whether a workflow
		/// definition can be edited safely or not. As a general rule, if any tasks are
		/// outstanding for the definition ID, the definition should NOT be edited.
		/// </summary>
		/// <param name="DefinitionID"></param>
		/// <returns></returns>
		bool CanBeEdited( int DefinitionID );
		/// <summary>
		/// This function should return true or false depending on whether a workflow 
		/// definition can be safely deleted or not. As a general rule, if CanBeEdited
		/// returns false, so should this. In addition, you should check to see if the 
		/// workflow definition is associated with any of your events, and if it is, this
		/// should return false.
		/// </summary>
		/// <param name="DefinitionID"></param>
		/// <returns></returns>
		bool CanBeDeleted( int DefinitionID );
		/// <summary>
		/// Implement functionality here to clean up any records if a workflow definition
		/// is deleted from the system. The engine will take care of any cleanup in the
		/// workflow definitions tables and tasks list, but any additional tables you might
		/// use during a workflow should be cleared in this function.
		/// </summary>
		/// <param name="DefinitionID"></param>
		void OnDeleteWorkflowDefinition( int DefinitionID );
		#endregion
		#region Operator Query
		/// <summary>
		/// Returns a WorkflowTaskableOperators object representing all
		/// the operators on the system that can have tasks raised against them
		/// </summary>
		/// <returns></returns>
		WorkflowTaskableOperators GetTaskableOperators();
		/// <summary>
		/// Returns a WorkflowTaskableGroups object representing all the
		/// operator groups on the system that can have tasks against them
		/// </summary>
		/// <returns></returns>
		WorkflowTaskableGroups GetTaskableGroups();
		/// <summary>
		/// Return a WorkflowTaskableOperator object representing the
		/// operator by the ID passed in.
		/// </summary>
		/// <param name="OperatorID"></param>
		/// <returns></returns>
		WorkflowTaskableOperator GetTaskableOperator( int OperatorID );
		/// <summary>
		/// Return a WorkflowTaskableGroup object representing the 
		/// group by the ID passed in
		/// </summary>
		/// <param name="GroupID"></param>
		/// <returns></returns>
		WorkflowTaskableGroup GetTaskableGroup( int GroupID );
		/// <summary>
		/// Returns a WorkflowTaskableOperatros object representing all
		/// the operators on the system within the group ID specified
		/// </summary>
		/// <param name="GroupID"></param>
		/// <returns></returns>
		WorkflowTaskableOperators GetTaskableOperatorsForGroup( int GroupID );
		#endregion
		#region URLs for Edit and View
		/// <summary>
		/// Override and return string.empty if the data can never be edited,
		/// or return the URL to edit the data associated with the task object
		/// </summary>
		/// <param name="Task"></param>
		/// <returns></returns>
		string GetEditURL( Task Task );
		/// <summary>
		/// Override and return string.empty if the data can never be viewed,
		/// or return the URL to view the data associated with the task object
		/// </summary>
		/// <param name="Task"></param>
		/// <returns></returns>
		string GetViewURL( Task Task );
		#endregion
		#region Data Dictionary
		/// <summary>
		/// Returns the value of a data dictionary item from the object being managed
		/// </summary>
		/// <param name="Key"></param>
		/// <param name="DataID"></param>
		/// <returns></returns>
		string DataDictionaryItem( string Key, int DataID );
		/// <summary>
		/// Return information concerning what information is exposed from the 
		/// object into the workflow.
		/// </summary>
		/// <returns></returns>
		WorkflowDataDictionaryDescriptor GetDataDictionary();
		#endregion
	}
}
